﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TrayCheckControl.Types
{
    public class TrayInfo
    {
        private string code = "";
        public string Code
        {
            get => this.code;
            set
            {
                this.code = value;
                this.CurrentTimes = -1;
                this.MaximumTimes = -1;
                this.RemainTimes = 0;
                this.PmCurrent = DateTime.MinValue; ;
                this.PmPeriod = string.Empty;
                this.IsLocked = true;
                this.message.Clear();
            }
        }
        public int CurrentTimes { get; set; } = -1;
        public int MaximumTimes { get; set; } = -1;
        public int RemainTimes { get; set; } = 0;
        public DateTime PmCurrent { get; set; } = DateTime.MinValue;
        public string PmPeriod { get; set; } = string.Empty;
        public bool IsLocked { get; set; } = true;
        public List<string> message { get; set; } = new List<string>();
        //public bool IsOk { get; set; } = false;
        public void Init()
        {
            this.Code = "";
            this.CurrentTimes = -1;
            this.MaximumTimes = 0;
            this.RemainTimes = 0;
            this.PmCurrent = new DateTime(0, 0, 1);
            this.PmPeriod = string.Empty;
            this.message.Clear();
            //this.IsOk = false;
        }
        public void Copy(TrayInfo info)
        {
            this.Code = info.code;
            this.RemainTimes = info.RemainTimes;
            this.MaximumTimes = info.MaximumTimes;
            this.CurrentTimes = info.CurrentTimes;
            this.PmCurrent = info.PmCurrent;
            this.PmPeriod = info.PmPeriod;
            this.message.Clear();
            this.message.AddRange(info.message);
            //this.IsOk = info.IsOk;
        }
    }
}
